$sectors:
  y(s)              ! production
  c                 ! aggregate consumption
  g                 ! government expenditure

$commodities:
  p(o)              ! price of commodity
  pc                ! price of aggregate consumption
  pg                ! price of a unit of government output
  pf(f)             ! price of primary factor

$consumers:
  ra                ! representative agent income
  gov               ! government income

$prod:y(s)          s:sigma(s)   t:theta(s)
  o:p(o)            q:supply(s)       p:t_y_l(o,s)          a:gov     t:t_y(o,s)
* Introduce Coefficient supply_(s,o) and fm(initial): supply_(s,o)=supply(s)
* Introduce Coefficient equal to Revenue: rev_y(s) and formula rev_y(s)=SUM(o,SUPPLY_(s,o))
* We interpret p(o) as %-change in basic price
* We introduce ps_y_p(s,o) %-change in user price
* Taxes:
* Introduce Coefficient levels value of power of tax: T_t_y_p_gov(s,o)
* Introduce Coeff equal to revenue from this tax: TR_t_y_p_gov(s,o)
* In this o row, the identifier after p: is the pre-sim value of the power of tax (assuming pre-sim basic prices are 1)
* All taxes on outputs are defined on gross basis. [If tax is 20%, user-price is  0.8*basic-price] MPS convention
* MPS convention: Pre-sim. Basic price is 1. User price for output is 1*(1-t) where t is rate of output tax  
* Compute initial levels value of power of tax: fm(initial) T_t_y_p_gov(s,o) = t_y_l(o,s)
* Compute initial revenue from tax: formula(initial): TR_t_y_p_gov(s,o)= [1 - t_y_l(o,s)]*supply(s)
* We introduce variable %-change in power of tax t_y_p_gov(s,o)
* We introduce equation to handle taxes: ps_y_p(s,o) = p(o) - t_y_p_gov(s,o) 

* Without taxes:
* Price Variable ps_y(s) equal to %-change in marginal revenue in sector s and 
*  marginal-revenue equation:  rev_s(s)*ps_y(s) = SUM(o,SUPPLY_(s,o)*p(o))
* New quantity variable %-change in quantity supplied (ie, produced) qs_y_p(s,o)
* Quantity equation for output: (all,s)(all,o) qs_y_p(s,o) = y(s) + theta(s)*[p(o)-ps_y(s)]

* With taxes:
* Price Variable ps_y(s) equal to %-change in marginal revenue in sector s and 
*  marginal-revenue equation:  rev_s(s)*ps_y(s) = SUM(o,SUPPLY_(s,o)*ps_y_p(s,o))
* New quantity variable %-change in quantity supplied (ie, produced) qs_y_p(s,o)
* Quantity equation for output: (all,s)(all,o) qs_y_p(s,o) = y(s) + theta(s)*[p(o)-ps_y_p(s,o)]

  i:pf(f)           q:factor(f,s)
  i:p(o)            q:interm(o,s)
* Introduce coefficients factor_(s,f) and interm_(s,o) and fm(initial)..
* Introduce coefficient equal to cost: cost_y(s) and 
*   formula: cost_y(s)=SUM(f,FACTOR_(s,f)) + SUM(o,INTERM_(s,o))
* Price Variable pd_y(s) equal to %-change in marginal costs in sector s and
*  marginal-cost equation: cost_y(s)*pd_y(s) = SUM(f,FACTOR_(s,f)*pf(f)) + SUM(o,INTERM_(s,o)*p(o))
* Zero-profit equation: rev_s(s)*ps_y(s) = cost_y(s)*pd_y(s)
* Two New quantity variables:                 

$prod:c             s:sigma2
  o:pc              q:cons
  i:p(o)            q:demand(o)         p:t_x_l(o)          a:gov     t:t_x(o)

$prod:g             s:1.0
  o:pg              q:govcons
  i:p(o)            q:govdem(o)

$demand:ra
  d:pc              q:cons
  e:pf(f)           q:endow(f)

$demand:gov
  d:pg              q:govcons